import {Component, forwardRef, OnInit} from '@angular/core';
import {ControlUIWidget, SFCustomWidgetSchema} from '@delon/form';
import {NG_VALUE_ACCESSOR} from '@angular/forms';


export interface IconUploadAlainSchema extends SFCustomWidgetSchema {

    maxFileSize?: number;

    valueChange?: (value: string) => any;

}

@Component({
    // tslint:disable-next-line:component-selector
    selector: 'icon-upload-alain',
    templateUrl: './icon-upload-alain.component.html',
    styleUrls: ['./icon-upload-alain.component.less'],
    providers: [
        {
            provide: NG_VALUE_ACCESSOR,
            useExisting: forwardRef(() => IconUploadAlainComponent),
            multi: true
        }
    ]
})

export class IconUploadAlainComponent extends ControlUIWidget<IconUploadAlainSchema> implements OnInit {

    /* 用于注册小部件 KEY 值 */
    static readonly KEY = 'icon-upload-alain';

    iconBase64Value;

    ngOnInit(): void {

    }

    reset(_value: any): void {
        if (!_value) {
            return;
        }
        this.iconBase64Value = _value;
    }
}
